﻿using System;
using CTEM.Controllers.Global;

/// <summary>
/// Entity for table Construction
/// </summary>

namespace CTEM.Models
{
    public class CT_PurchaseBookDTO
    {
        public long PurchaseBookID { get; set; }
        public long DebtID { get; set; }
        public DateTime DatePurchase { get; set; }
        public string Officer { get; set; }
        public long VehicleID { get; set; }
        public long ConstructionID { get; set; }
        public long WarehouseID { get; set; }
        public string Contents { get; set; }
        public long MaterialID { get; set; }
        public long GroupMaterialID { get; set; }
        public double Quantity { get; set; }
        public long Price { get; set; }
        public long TotalCost { get; set; }
        public bool IsPay { get; set; }
        public bool IsConfirm { get; set; }
        public string Note { get; set; }
        public DateTime? CreatedDate { get; set; }
        public DateTime? LastUpdated { get; set; }
        public string CreatedBy { get; set; }
        public string UpdatedBy { get; set; }
        public long ComparationDebtID { get; set; }

        public string Unit { get; set; }
        public HistoryLevel History { get; set; }

        public CT_PurchaseBookDTO()
        {
            PurchaseBookID = 0;
            DebtID = 0;
            DatePurchase = DateTime.Today;
            Officer = Constants.EMPTY_TEXT;
            Contents = Constants.EMPTY_TEXT;
            MaterialID = 0;
            GroupMaterialID = 0;
            Quantity = 0;
            Price = 0;
            TotalCost = 0;
            IsPay = false;
            IsConfirm = false;
            Note = Constants.EMPTY_TEXT;
            CreatedBy = Global.CurrentUser.Username;
            UpdatedBy = Global.CurrentUser.Username;
            CreatedDate = DateTime.Today;
            LastUpdated = DateTime.Today;
            ComparationDebtID = 0;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(CT_PurchaseBookDTO)) return false;
            return Equals((CT_PurchaseBookDTO)obj);
        }

        public bool Equals(CT_PurchaseBookDTO other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.PurchaseBookID, PurchaseBookID);
        }

        public static bool operator == (CT_PurchaseBookDTO left, CT_PurchaseBookDTO right)
        {
            return Equals(left, right);
        }

        public static bool operator != (CT_PurchaseBookDTO left, CT_PurchaseBookDTO right)
        {
            return !Equals(left, right);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}